package alcatraz.common;

/**
 * utility class of game
 * 
 * @author andreas
 */
public final class Util implements IAlcatraz {

    /**
     * constructor: private (hided) because only class methodes existing
     */
    private Util() {
        
    }

    /**
     * notify severe Exception via System.err (Console output)
     *
     * @param e object of type Exception class
     * @param starting true: exception eppears during starting application
     */
    public static void printSevereException(Exception e, boolean starting) {
        System.err.print("Die Applikation ");
        if(starting) {
            System.err.println("kann aus folgendem");
            System.err.println("Grund nicht gestarted werden:");
        } else {
            System.err.println("muss aus folgendem");
            System.err.println("Grund abgebrochen werden:");
        }
            System.err.print(e.toString());
    }

    /**
     * check String object wheter is empty
     *
     * @param value as String object
     * @return true: given String is empty
     */
    public static boolean isEmpty(String value) {
        if (value == null || "".equals(value)) {
            // string points to nil or length of string is zero
            return true;
        }
        return false;
    }

}
